<?php
session_start();
mysql_query("set names utf8");
header("content-type:text/html; charset=utf-8");
require_once("../fm/utils/conn.php");
require_once("config.php");
$params=urldecode(file_get_contents("php://input"));

$tmp=explode('&',$params);
foreach($tmp as $t)
{
	list($k,$v)=explode('=',$t);
	$arr[$k]=$v;
}

$db = new mysql_db();
$findMember="select * from member where email='".$arr["userId"]."'";

$memberResult=$db->data($findMember);

if($memberResult["total"]<=0){
   print_r($db->createJson(false,"","找不到该用户"));
}
elseif($memberResult["data"][0]["password"]==$arr["password"]){

   $_SESSION['family_current']=$memberResult["data"][0]["familyNum"];
   $_SESSION['user_m_current']=$memberResult["data"][0]["email"];
   $_SESSION['user_n_current']=$memberResult["data"][0]["nickname"];
   $_SESSION['user_id_current']=$memberResult["data"][0]["id"];

   print_r($db->createJson(true,$arr["userId"],""));
}
else{
   print_r($db->createJson(false,"","密码错误"));
}
?>